package com.tuanzi.loan.web.bean.family.largeamount;

import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.vo.request.family.largeamount.LoanLargeAmountGzhRequest;
import com.tuanzi.loan.vo.response.family.largeamount.LoanLargeAmountGzhResponse;
import com.tuanzi.loan.web.configuration.JSFListingBean;
import com.tuanzi.loan.web.lazy.family.largeAmount.LoanLargeAmountLazyDataModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;

/**
 * User: liangZongXi
 * Create time: 19:08 2019/3/28
 * Description:
 */
@Data
@Slf4j
@Debug
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class LoanLargeAmountGzhBean  extends JSFListingBean<LoanLargeAmountGzhRequest, LoanLargeAmountGzhResponse> {
    private static final long serialVersionUID = -992889895797606731L;

    @PostConstruct
    private void init() {
        initLazyDataModel();
    }

    private void initLazyDataModel() {
        $ = new LoanLargeAmountGzhRequest();
        lazyDataModel = new LoanLargeAmountLazyDataModel($);
    }

    public void onReset(){
        initLazyDataModel();
    }

    public String onView(Long userInfoId){
        if(null == userInfoId){
            addErrorMessage("不存在的ID,请刷新再试");
            return null;
        }
        return redirect("/views/family/WholeSaleManage/large-amount-gzh-detail.xhtml?id=" + userInfoId);
    }

}
